package com.example.xingzai.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.Button01).setOnClickListener(this);
        findViewById(R.id.Button02).setOnClickListener(this);
        findViewById(R.id.Button03).setOnClickListener(this);
        findViewById(R.id.Button04).setOnClickListener(this);
        findViewById(R.id.Button05).setOnClickListener(this);
        findViewById(R.id.Button06).setOnClickListener(this);
        findViewById(R.id.Button07).setOnClickListener(this);
    }

    @Override
    public void onClick(View arg0) {
        Intent intent = new Intent();
        switch (arg0.getId()) {
            case R.id.Button01:
                intent.setClass(MainActivity.this, FirstActivity.class);
                break;
            case R.id.Button02:
                intent.setClass(MainActivity.this, SecondActivity.class);
                break;
            case R.id.Button03:
                intent.setClass(MainActivity.this, TestActivity.class);
                break;
            case R.id.Button04:
                intent.setClass(MainActivity.this, ThirdActivity.class);
                break;
            case R.id.Button05:
                intent.setClass(MainActivity.this, ServiceActivity.class);
                break;
            case R.id.Button06:
                intent.setClass(MainActivity.this, MapActivity.class);
                break;
            case R.id.Button07:
                intent.setClass(MainActivity.this, ComplexActivity.class);
                break;
            default:
                break;
        }
        MainActivity.this.startActivity(intent);
    }

}

